Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Allow raising errors from within a custom whatever(#2718) #4188

Merged
merged 20 commits into from
Aug 3, 2024

Conversation

abdalla-rko
Copy link
Contributor

Reasons for making this change

I introduced a raiseFieldErrors method to raise errors from within a custom component(see #2718).

The current behavior allows errors to be raised from custom components and when the form onChange is triggered, we clear the custom raised errors. I appreciate any feedback on this approach. If everything looks good, I'll write tests and implement this in other themes.

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@heath-freenome
Copy link
Member

heath-freenome commented May 10, 2024

@abdalla-rko If the goal is to update the errorSchema via a custom widget, maybe it makes sense to update the onChange in WidgetProps to function similarly to the onChange in FieldProps, where the errorSchema can be updated as it is flows through the schema hierarchy. Feel free to join the next meeting so we can talk about it. Or reach out to me on Discord

@nickgros
Copy link
Contributor

@abdalla-rko are you still working on this?

@abdalla-rko
Copy link
Contributor Author

Hi @heath-freenome, Sorry for taking too long. I think the initial implementation is now like you suggested updating the errorSchema using onChange in the custom widget. Let me know if it's good and then I'll update the docs and other themes if needed.

packages/core/src/components/Form.tsx Outdated Show resolved Hide resolved
packages/core/src/components/Form.tsx Outdated Show resolved Hide resolved
packages/utils/src/types.ts Show resolved Hide resolved
Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, just a couple of small things. Also, can you resolve the conflicts?

packages/core/test/ObjectField.test.jsx Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Added missing packages
Added missing space
@abdalla-rko abdalla-rko closed this Aug 2, 2024
@abdalla-rko abdalla-rko reopened this Aug 2, 2024
@heath-freenome heath-freenome merged commit 4d3094c into rjsf-team:main Aug 3, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants